﻿using System;
using PresentationNamespace;

namespace PresentationTests
{
    public class FakeView : IView
    {
        public string KnownValue { get; set; }
        public string KnownMeasure { get; set; }
        public string WantedValue { get; set; }
        public string WantedMeasure { get; set; }
        public string ErrorMessage { get; set; }
        public string LogFileName { set; get; }
        public string[] LogText { set; get; }
        public bool IsTxtLoggerSelected { get; set; }
        public bool IsHtmlLoggerSelected { get; set; }
        public object[] MeasureTypes { get; set; }

        public event Action OnConvertClick;
        public event Action OnSaveLogAsTxtClick;
        public event Action OnShowLogAsTxtClick;
        public event Action OnSaveLogAsHtmlClick;
        public event Action OnShowLogAsHtmlClick;
        public event Action LoggerTypeChanged;
        
        public FakeView(int loggerType = 0)
        {
            if (loggerType == 0)
            {
                IsTxtLoggerSelected = true;
                IsHtmlLoggerSelected = false;
            }
            else
            {
                IsTxtLoggerSelected = false;
                IsHtmlLoggerSelected = true;
            }
        }
        
        public ILogger CreateTxtLogger()
        {
            return new FakeLogger();
        }

        public ILogger CreateHtmlLogger()
        {
            return new FakeLogger(1);
        }

        public void ConvertClick()
        {
            OnConvertClick();
        }

        public void SaveLogAsTxtClick()
        {
            OnSaveLogAsTxtClick();
        }

        public void ShowLogAsTxtClick()
        {
            OnShowLogAsTxtClick();
        }

        public void SaveLogAsHtmlClick()
        {
            OnSaveLogAsHtmlClick();
        }

        public void ShowLogAsHtmlClick()
        {
            OnShowLogAsHtmlClick();
        }

        public void ChangeLogger()
        {
            IsHtmlLoggerSelected = !IsHtmlLoggerSelected;
            IsTxtLoggerSelected = !IsTxtLoggerSelected;
            LoggerTypeChanged();
        }

    }
}
